﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="../bootstrap/js/jquery.min.js"></script>
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <!--[if lt IE 9]>
        <script src="bootstrap/js/html5shiv.min.js"></script>
        <script src="bootstrap/js/respond.min.js"></script>
    <![endif]-->
    <script src="../config.js"></script>
    <script src="../bootstrap/js/Common.js"></script>
    <script src="../bootstrap/js/controls.js"></script>
    <script type="text/javascript">
        var Id = GetUrlParam("id");
        $(function() {
            var formOption = {
                items: [
                    {
                        name: "dataPointID",
                        title: "变量名",
                        field: "dataPointID",
                        type: "text",
                        readonly:true
                    }, {
                        name: "value",
                        title: "value值",
                        field: "value",
                        type: "text"
                    }
                ]
            };
            $(".form-horizontal").form(formOption).load(host_name + "varDeclares/single?id=" + Id);
        });
        function Save() {
            var dId = $("#dataPointID").val();
            $.ajax({
                url: host_name +"terminalcommand/" + dId,
                type: "post",
                data: { "value": $("#value").val() },
                success: function (data) {
                    if (data && data.code == 200) {
                        alert("数据写入成功！");
                    }
                    else {
                        alert("数据写入失败！");
                    }
                },
                error: function (request) {
                    alert("连接失败");
                }
            });
        }
    </script>
</head>
<body>
<div class="container">
    <form class="form-horizontal">
    </form>
</div>
</body>
</html>